package com.hos.controller;

import com.hos.dao.MessageMapper;
import com.hos.framework.Result;
import com.hos.framework.ResultBean;
import com.hos.framework.ResultUtil;
import com.hos.pojo.Doctor;
import com.hos.pojo.Message;
import com.hos.service.MessageService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/api/message")
public class MessageController {
    @Resource
    MessageService messageService;


    @GetMapping("/list")
    public ResultBean<List<Message>> getPageResult() {

        Map<String, Object> param = new HashMap<>(16);
        // 获取当前页结果集
        List<Message> entities = messageService.select();

        return new ResultBean<>(0, "查询成功", 10,entities);
    }

    @PostMapping("/save")
    Result<String> insert(Message entity){
        messageService.insert(entity);

        return ResultUtil.ok();
    }

    @PostMapping("/remove")
    Result<String> delete(@RequestBody Integer[] ids){
        messageService.delete(ids);
        return ResultUtil.ok();
    }
}
